#pragma once

#include "AffineTransform.h"

class XmlNode;

class Bone
{
public:
	Bone( std::string name );
	~Bone(void);

public:
	std::string GetName()	{ return m_name; }

	void SetParent( Bone * parent )	{ m_parent = parent; }
	Bone * GetParent() { return m_parent; }

	void AddChild( Bone * childBone );
	int GetChildCount() { return (int)m_children.size(); } 
	Bone * GetChildNodeByIndex( int index ) { return m_children[index]; }

public:
	void MakeLocalTransform();
	void CalculateWorldTransform();

public:
	Matrix m_localTransform;
	Matrix m_worldTransform;
	AffineTransform m_blendTransform;

private:
	std::string m_name;
	Bone * m_parent;
	std::vector<Bone*> m_children;
};

class BoneTraversal
{
public:
	BoneTraversal( Bone * root );

	Bone * GetNext();

private:
	std::vector<Bone*> m_boneStack; 
};
